<html>

<head>
<<<<<<< .mine
<title> hey,there this is a test</title>
<script src="../EWGL/EWGL_init.js"></script>
<script>
var gl = EWGL("3dCanvas")
=======
<title>lesson 1</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript" src="../EWGL/EWGL_init.js"></script>
<script type="text/javascript" src="../EWGL/EWGL_shader.js"></script>
<script type="text/javascript" src="../EWGL/EWGL_util.js"></script>
<script type="text/javascript" src="../EWGL/EWGL_math.js"></script>

<script id="shader-fs" type="x-shader/x-fragment">
    void main(void)
    {
        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
    }
>>>>>>> .r49
</script>

<script id="shader-vs" type="x-shader/x-vertex">
  attribute vec3 aVertexPosition;

  uniform mat4 uMVMatrix;
  uniform mat4 uPMatrix;

  void main(void)
  {
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
  }
</script>


<script type="application/x-javascript">
/*  var webgl;
  var gl;
  var fps;
  var rotation = 0; 

  var mvMatrix = EWGL.matrix();
  var pMatrix = EWGL.matrix();
  
  function perspective(fovy, aspect, znear, zfar)
  {
	// aspect = width/height
    pMatrix = EWGL.Matrix.perspective(fovy, aspect, znear, zfar);
    gl.uniformMatrix4fv(webgl.shaders.shader1.uniforms.uPMatrix, false, FloatArray(pMatrix));
	
  }

  var triangleVertexPositionBuffer;
  var squareVertexPositionBuffer;
  function initBuffers()
  {
	var vertices = [
         0.0,  1.0,  0.0,
        -1.0, -1.0,  0.0,
         1.0, -1.0,  0.0
    ];
    triangleVertexPositionBuffer = EWGL.buffer(gl,vertices);
	
	vertices = [
		 1.0,  1.0,  0.0,
        -1.0,  1.0,  0.0,
         1.0, -1.0,  0.0,
        -1.0, -1.0,  0.0
	];
    squareVertexPositionBuffer = EWGL.buffer(gl,vertices,3,4,{"prim" : gl.TRIANGLE_STRIP});
  }


  function drawScene()
  {
	var vertexposition = webgl.shaders.shader1.attributes.aVertexPosition;
	var uMVMatrix = webgl.shaders.shader1.uniforms.uMVMatrix;
	rotation++;

	webgl.fps.snapshot();
    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

    mvMatrix.I();

    mvMatrix.translation([-1.5, 0.0, -7.0]);
	mvMatrix.rotation(rotation/20,[0.0, 1.0, 0.0]);
	gl.uniformMatrix4fv(uMVMatrix, false, mvMatrix);
	triangleVertexPositionBuffer.draw(gl,vertexposition);
	
    mvMatrix.translation([3.0, 0.0, 0.0]);
	gl.uniformMatrix4fv(uMVMatrix, false, mvMatrix);
	squareVertexPositionBuffer.draw(gl,vertexposition);
	
	gl.flush();
  }
*/
	function webGLStart()
	{
		var shader1 = { "name" : "shader1",							// a name to be able to call it by
						"vs" : "shader-vs",							// vertex shader id
						"fs" : "shader-fs",							// frame shader id
						"attributes" : ["aVertexPosition"],			// shader attributes
						"uniforms" : ["uMVMatrix","uPMatrix"]};		// shader uniforms
		
		webgl = EWGL(	"example1-canvas",    						// canvasid
						[shader1],									// shaders
						{											// extra options
							framerate : 	["fpsspan",250],		// extra option framerate
							clearcolor:		[0.0, 0.0, 0.0, 1.0],	// extra option clearing color
							cleardepth: 	[1.0]						// extra option enable depthbuffer
						});						 
		gl = webgl.gl;
/*		
		gl.uniformMatrix4fv(webgl.shaders.shader1.uniforms.uPMatrix, false, pMatrix.perspective(45,1.0,0.1,100));
		
		initBuffers();
		setInterval(drawScene, 20);*/
  	}
</script>


</head>

<body onload="webGLStart()">
  <canvas id="example1-canvas" style="border: none;" width="500" height="500"></canvas>
  <br \>
  <p>fps: <span id="fpsspan"></span></p>
</body>

</html>